/**
* Group: Y1
* The Bullet class will instantiate bullets that can be used in gameplay
* Usage: Bullet(positionX, positionY, tangentialvelocityX, tangentialvelocityY);
* @author Venkat Patnala
* @author Mason Kwiat
*/
package lightspeed.Backend;
import java.net.*;
import java.io.*;

public class Bullet implements Serializable{
	
	private double vX, vY;
	private double x, y;
	public short team;
	private short lt;
	
	/**
	* Constructor: creates a bullet instance, and sets its characterisitcs
	* @param X x-posiiton of the bullet
	* @param Y y-position of the bullet
	* @param t the team of the bullet
	* @param vX the x-velcity of the bullet
	* @param vY the y-velcity of the bullet
	*/
	public Bullet(double X, double Y, short t, double tX, double tY) {
		this.x = X;
		this.y = Y;
		this.team = t;
		this.vX = tX;
		this.vY = tY;
		lt = 20;
	}
	/**
	* Returns the x-position of the bullet
	* @return int that holds the x position of the bullet
	*/
	
	public double getX() {
		return x;
	}
	/**
	* Returns the y-position of the bullet
	* @return int that holds the y position of the bullet
	*/
	public double getY() {
		return y;
	}
	/**
	* Returns the x-velocity of the bullet
	* @return int that holds the x velocity of the bullet
	*/
	public double getVx() {
		return vX;
	}
	/**
	* Returns the y-velocity of the bullet
	* @return int that holds the y velocity of the bullet
	*/
	
	public double getVy() {
		return vY;
	}
	/**
	* Updates the bullet's position
	* @return boolean that determines wheather the bullet's position was updated
	*/
	public boolean updatePosition() {
		if(lt!=0)
		{
			lt--;
			x += vX;
			y += vY;
			return true;
		}else {
			return false;
		}
	}
	
}
